# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PubSubLite.V1.Model.PartitionConfig do
  @moduledoc """
  The settings for a topic's partitions.

  ## Attributes

  *   `capacity` (*type:* `GoogleApi.PubSubLite.V1.Model.Capacity.t`, *default:* `nil`) - The capacity configuration.
  *   `count` (*type:* `String.t`, *default:* `nil`) - The number of partitions in the topic. Must be at least 1. Once a topic has been created the number of partitions can be increased but not decreased. Message ordering is not guaranteed across a topic resize. For more information see https://cloud.google.com/pubsub/lite/docs/topics#scaling_capacity
  *   `scale` (*type:* `integer()`, *default:* `nil`) - DEPRECATED: Use capacity instead which can express a superset of configurations. Every partition in the topic is allocated throughput equivalent to `scale` times the standard partition throughput (4 MiB/s). This is also reflected in the cost of this topic; a topic with `scale` of 2 and count of 10 is charged for 20 partitions. This value must be in the range [1,4].
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :capacity => GoogleApi.PubSubLite.V1.Model.Capacity.t() | nil,
          :count => String.t() | nil,
          :scale => integer() | nil
        }

  field(:capacity, as: GoogleApi.PubSubLite.V1.Model.Capacity)
  field(:count)
  field(:scale)
end

defimpl Poison.Decoder, for: GoogleApi.PubSubLite.V1.Model.PartitionConfig do
  def decode(value, options) do
    GoogleApi.PubSubLite.V1.Model.PartitionConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.PubSubLite.V1.Model.PartitionConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
